<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><script type="text/javascript" src="https://cdn.jsdelivr.net/gh/opencobra/cobratoolbox@ffa0229fc0c01c9236bb7e961f65712443277719/latest/_static/js/iframeResizer.contentWindow.min.js"></script><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,IE=9,chrome=1"><meta name="generator" content="MATLAB 2021a"><title>Reaction essentiality across multiple models</title><style type="text/css">.rtcContent { padding: 30px; } .S0 { margin: 3px 10px 5px 4px; padding: 0px; line-height: 28.8px; min-height: 0px; white-space: normal; color: rgb(213, 80, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 24px; font-weight: normal; text-align: left;  }
.S1 { margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: normal; text-align: left;  }
.S2 { margin: 20px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: normal; color: rgb(60, 60, 60); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;  }
.S3 { margin: 3px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: normal; color: rgb(60, 60, 60); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;  }
.CodeBlock { background-color: #F7F7F7; margin: 10px 0 10px 0;}
.S4 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 1px solid rgb(233, 233, 233); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 4px 4px 0px 0px; padding: 6px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S5 { color: rgb(64, 64, 64); padding: 10px 0px 6px 17px; background: rgb(255, 255, 255) none repeat scroll 0% 0% / auto padding-box border-box; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234px;  }
/* Styling that is common to warnings and errors is in diagnosticOutput.css */.embeddedOutputsErrorElement {    min-height: 18px;    max-height: 250px;    overflow: auto;}
.embeddedOutputsErrorElement.inlineElement {}
.embeddedOutputsErrorElement.rightPaneElement {}
/* Styling that is common to warnings and errors is in diagnosticOutput.css */.embeddedOutputsWarningElement{    min-height: 18px;    max-height: 250px;    overflow: auto;}
.embeddedOutputsWarningElement.inlineElement {}
.embeddedOutputsWarningElement.rightPaneElement {}
/* Copyright 2015-2019 The MathWorks, Inc. *//* In this file, styles are not scoped to rtcContainer since they could be in the Dojo Tooltip */.diagnosticMessage-wrapper {    font-family: Menlo, Monaco, Consolas, "Courier New", monospace;    font-size: 12px;}
.diagnosticMessage-wrapper.diagnosticMessage-warningType {    color: rgb(255,100,0);}
.diagnosticMessage-wrapper.diagnosticMessage-warningType a {    color: rgb(255,100,0);    text-decoration: underline;}
.diagnosticMessage-wrapper.diagnosticMessage-errorType {    color: rgb(230,0,0);}
.diagnosticMessage-wrapper.diagnosticMessage-errorType a {    color: rgb(230,0,0);    text-decoration: underline;}
.diagnosticMessage-wrapper .diagnosticMessage-messagePart,.diagnosticMessage-wrapper .diagnosticMessage-causePart {    white-space: normal;}
.diagnosticMessage-wrapper .diagnosticMessage-stackPart {    white-space: normal;}
.embeddedOutputsTextElement,.embeddedOutputsVariableStringElement {    white-space: normal;    word-wrap:  initial;    min-height: 18px;    max-height: 250px;    overflow: auto;}
.textElement,.rtcDataTipElement .textElement {    padding-top: 3px;}
.embeddedOutputsTextElement.inlineElement,.embeddedOutputsVariableStringElement.inlineElement {}
.inlineElement .textElement {}
.embeddedOutputsTextElement.rightPaneElement,.embeddedOutputsVariableStringElement.rightPaneElement {    min-height: 16px;}
.rightPaneElement .textElement {    padding-top: 2px;    padding-left: 9px;}
.S6 { margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: normal; text-align: left;  }
.S7 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 1px solid rgb(233, 233, 233); border-bottom: 0px none rgb(0, 0, 0); border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S8 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 0px none rgb(0, 0, 0); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S9 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 1px solid rgb(233, 233, 233); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 4px; padding: 6px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S10 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 0px none rgb(0, 0, 0); border-bottom: 0px none rgb(0, 0, 0); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S11 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 0px none rgb(0, 0, 0); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 0px; padding: 0px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }</style></head><body><div class = rtcContent><h1  class = 'S0'><span style=' font-weight: bold;'>Reaction essentiality across multiple models</span></h1><div  class = 'S1'><span style=' font-weight: bold;'></span></div><div  class = 'S1'><span style=' font-weight: bold;'>Note: This tutorial is a draft and needs completion. Contributions welcome!</span></div><div  class = 'S1'><span style=' font-weight: bold;'></span></div><div  class = 'S1'><span style=' font-weight: bold;'>Authors: Miguel A.P. Oliveira, Diana C. El Assal-Jordan, Sylvain Arreckx and Ronan M.T. Fleming, Luxembourg Centre for Systems Biomedicine</span></div><div  class = 'S1'><span style=' font-weight: bold;'>Reviewers: </span></div><h2  class = 'S2'><span>Introduction</span></h2><div  class = 'S1'><span>During this tutorial, you will identify and compare which reactions are essential for ATP production within a set of metabolic models. This tutorial is particularly useful when studying metabolic functional abilities across multiple metabolic models.</span></div><div  class = 'S1'><span>This driver allows us to perform single reactions to identify essential ones that are required for ATP generation. This means that these essential reactions would carry a zero flux when optimising the ATP consumption reaction (ATPM).</span></div><div  class = 'S1'><span>Version 5/12/2017</span></div><h2  class = 'S3'><span>EQUIPMENT SETUP</span></h2><h2  class = 'S2'><span style=' font-weight: bold;'>Initialize the COBRA Toolbox </span><span>and set the solver</span></h2><div  class = 'S1'><span>Please ensure that The CobraToolbox has been properly installed, and initialized using the </span><span style=' font-family: monospace;'>initCobraToolbox</span><span> function.</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div  class = 'S4'><span style="white-space: normal"><span >initCobraToolbox(false) </span><span style="color: rgb(2, 128, 9);">% false, as we don't want to update</span></span></div><div  class = 'S5'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement scrollableOutput" uid="7B210637" data-testid="output_0" data-width="428" data-height="325" data-hashorizontaloverflow="true" style="width: 458px; max-height: 336px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">      _____   _____   _____   _____     _____     |
     /  ___| /  _  \ |  _  \ |  _  \   / ___ \    |   COnstraint-Based Reconstruction and Analysis
     | |     | | | | | |_| | | |_| |  | |___| |   |   The COBRA Toolbox - 2017
     | |     | | | | |  _  { |  _  /  |  ___  |   |
     | |___  | |_| | | |_| | | | \ \  | |   | |   |   Documentation:
     \_____| \_____/ |_____/ |_|  \_\ |_|   |_|   |   <a href="http://opencobra.github.io/cobratoolbox" style="white-space: normal; font-style: normal; color: rgb(0, 95, 206); font-size: 12px;">http://opencobra.github.io/cobratoolbox</a>
                                                  | 

 &gt; Checking if git is installed ...  Done.
 &gt; Checking if the repository is tracked using git ...  Done.
 &gt; Checking if curl is installed ...  Done.
 &gt; Checking if remote can be reached ...  Done.
 &gt; Initializing and updating submodules (this may take a while)... Done.
 &gt; Adding all the files of The COBRA Toolbox ...  Done.
 &gt; Define CB map output... set to svg.
 &gt; TranslateSBML is installed and working properly.
 &gt; Configuring solver environment variables ...
   - [----] ILOG_CPLEX_PATH: --&gt; set this path manually after installing the solver ( see <a href="https://opencobra.github.io/cobratoolbox/docs/solvers.html" style="white-space: normal; font-style: normal; color: rgb(0, 95, 206); font-size: 12px;">instructions</a> )
   - [*---] GUROBI_PATH: /Library/gurobi751/mac64/matlab
   - [----] TOMLAB_PATH: --&gt; set this path manually after installing the solver ( see <a href="https://opencobra.github.io/cobratoolbox/docs/solvers.html" style="white-space: normal; font-style: normal; color: rgb(0, 95, 206); font-size: 12px;">instructions</a> )
   - [----] MOSEK_PATH: --&gt; set this path manually after installing the solver ( see <a href="https://opencobra.github.io/cobratoolbox/docs/solvers.html" style="white-space: normal; font-style: normal; color: rgb(0, 95, 206); font-size: 12px;">instructions</a> )
   Done.
 &gt; Checking available solvers and solver interfaces ...</div></div><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement scrollableOutput" uid="8B16DD90" data-testid="output_1" data-width="428" data-height="605" data-hashorizontaloverflow="true" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"> Done.
 &gt; Setting default solvers ... Done.
 &gt; Saving the MATLAB path ... Done.
   - The MATLAB path was saved in the default location.

 &gt; Summary of available solvers and solver interfaces

			Support 	   LP 	 MILP 	   QP 	 MIQP 	  NLP
	----------------------------------------------------------------------
	cplex_direct 	active        	    0 	    0 	    0 	    0 	    -
	dqqMinos     	active        	    0 	    - 	    - 	    - 	    -
	glpk         	active        	    1 	    1 	    - 	    - 	    -
	gurobi       	active        	    1 	    1 	    1 	    1 	    -
	ibm_cplex    	active        	    0 	    0 	    0 	    - 	    -
	matlab       	active        	    0 	    - 	    - 	    - 	    0
	mosek        	active        	    0 	    0 	    0 	    - 	    -
	pdco         	active        	    1 	    - 	    1 	    - 	    -
	quadMinos    	active        	    0 	    - 	    - 	    - 	    0
	tomlab_cplex 	active        	    0 	    0 	    0 	    0 	    -
	qpng         	passive       	    - 	    - 	    1 	    - 	    -
	tomlab_snopt 	passive       	    - 	    - 	    - 	    - 	    0
	gurobi_mex   	legacy        	    0 	    0 	    0 	    0 	    -
	lindo_old    	legacy        	    0 	    - 	    - 	    - 	    -
	lindo_legacy 	legacy        	    0 	    - 	    - 	    - 	    -
	lp_solve     	legacy        	    0 	    - 	    - 	    - 	    -
	opti         	legacy        	    0 	    0 	    0 	    0 	    0
	----------------------------------------------------------------------
	Total        	-             	    3 	    2 	    3 	    1 	    0

 + Legend: - = not applicable, 0 = solver not compatible or not installed, 1 = solver installed.


 &gt; You can solve LP problems using: 'glpk' - 'gurobi' - 'pdco' 
 &gt; You can solve MILP problems using: 'glpk' - 'gurobi' 
 &gt; You can solve QP problems using: 'gurobi' - 'pdco' - 'qpng' 
 &gt; You can solve MIQP problems using: 'gurobi' 
 &gt; You can solve NLP problems using: 

 &gt; Checking for available updates ...
 &gt; Your branch &lt;develop&gt; is ahead by 1 commit(s).
 &gt; The COBRA Toolbox cannot be updated (already up-to-date).
 &gt; There are 183 new commit(s) on &lt;master&gt; and 254 new commit(s) on &lt;develop&gt; [282a65 @ develop]
 &gt; You can update The COBRA Toolbox by running updateCobraToolbox() (from within MATLAB).</div></div></div></div></div><div  class = 'S6'><span>The present tutorial can run with </span><a href = "https://opencobra.github.io/cobratoolbox/deprecated/docs/cobra/solvers/changeCobraSolver.html"><span>glpk package</span></a><span>, which does not require additional installation and configuration. Although, for the analysis of large models it is recommended to use the </span><a href = "https://github.com/opencobra/cobratoolbox/blob/master/docs/source/installation/solvers.md"><span>GUROBI</span></a><span> package.</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div  class = 'S4'><span style="white-space: normal"><span >changeCobraSolver(</span><span style="color: rgb(170, 4, 249);">'gurobi6'</span><span >,</span><span style="color: rgb(170, 4, 249);">'all'</span><span >)</span></span></div><div  class = 'S5'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement scrollableOutput" uid="F6F546DD" data-testid="output_2" data-width="428" data-height="283" data-hashorizontaloverflow="true" style="width: 458px; max-height: 294px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"> &gt; Gurobi interface added to MATLAB path.
 &gt; The compatibility can only be evaluated on macOS 10.12.
 &gt; The solver compatibility is not tested with MATLAB R2016a.
 &gt; Solver for LP problems has been set to gurobi.

 &gt; Gurobi interface added to MATLAB path.
 &gt; The compatibility can only be evaluated on macOS 10.12.
 &gt; The solver compatibility is not tested with MATLAB R2016a.
 &gt; Solver for MILP problems has been set to gurobi.

 &gt; Gurobi interface added to MATLAB path.
 &gt; The compatibility can only be evaluated on macOS 10.12.
 &gt; The solver compatibility is not tested with MATLAB R2016a.
 &gt; Solver for QP problems has been set to gurobi.

 &gt; Gurobi interface added to MATLAB path.
 &gt; The compatibility can only be evaluated on macOS 10.12.
 &gt; The solver compatibility is not tested with MATLAB R2016a.
 &gt; Solver for MIQP problems has been set to gurobi.
 &gt; Solver gurobi not supported for problems of type NLP. Currently used: matlab </div></div></div></div></div><h2  class = 'S2'><span>Define model directory</span></h2><div  class = 'S1'><span>In this tutorial, we use the cardiac model </span><span style=' font-family: monospace;'>modelCardioMito</span><span> [1] and study reaction essentiality across multiple versions this model based on the carbon sources used. This models was extracted from the latest version of the database of the human cellular metabolism, Recon 3D. For extra information about metabolites structures and reactions, and to download the latest COBRA model releases, visit the Virtual Metabolic Human database (VMH, </span><a href = "https://vmh.life"><span>https://vmh.life</span></a><span>). </span></div><div  class = 'S1'><span>Before proceeding with the simulations, locate the directory with the cardiac models: </span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: normal"><span >modelName = </span><span style="color: rgb(170, 4, 249);">'cardiac_mit_glcuptake_atpmax.mat'</span><span >;</span></span></div></div><div class="inlineWrapper"><div  class = 'S8'><span style="white-space: normal"><span >modelsDir = getDistributedModelFolder(modelName);</span></span></div></div></div><h2  class = 'S3'><span>PROCEDURE </span></h2><h2  class = 'S2'><span style=' font-weight: bold;'>1. Load the </span><span style=' font-family: monospace;'>modelCardioMito </span><span style=' font-weight: bold;'>model at set objective function:</span></h2><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S9'><span style="white-space: normal"><span >load([modelsDir filesep modelName])</span></span></div></div></div><div  class = 'S6'><span>Since we are studying reaction essentiality define the reaction </span><span style=' font-family: monospace;'>ATPS4m</span><span> as the objective function:</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S9'><span style="white-space: normal"><span >objFun = </span><span style="color: rgb(170, 4, 249);">'ATPS4m'</span><span >;</span></span></div></div></div><h2  class = 'S3'><span style=' font-weight: bold;'>2. Generate multiple cardiac models that use different carbon sources</span></h2><div  class = 'S1'><span style=' font-weight: bold;'>2.1. Close exchange reactions:</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: normal"><span >modelalter = modelCardioMito;</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >exchanges = {</span><span style="color: rgb(170, 4, 249);">'EX_12dgr_m(e)'</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(170, 4, 249);">'EX_arachd(e)'</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(170, 4, 249);">'EX_co2(e)'</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(170, 4, 249);">'EX_coa(e)'</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(170, 4, 249);">'EX_crvnc(e)'</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(170, 4, 249);">'EX_cys-L(e)'</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(170, 4, 249);">'EX_glc(e)'</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(170, 4, 249);">'EX_glu-L(e)'</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(170, 4, 249);">'EX_gly(e)'</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(170, 4, 249);">'EX_glyc(e)'</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(170, 4, 249);">'EX_glyc3p(e)'</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(170, 4, 249);">'EX_hdca(e)'</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(170, 4, 249);">'EX_lac-L(e)'</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(170, 4, 249);">'EX_ocdca(e)'</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(170, 4, 249);">'EX_ocdcea(e)'</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(170, 4, 249);">'EX_ocdcya(e)'</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(170, 4, 249);">'EX_ps_m(e)'</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(170, 4, 249);">'EX_urea(e)'</span><span >};</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span style="color: rgb(14, 0, 255);">for </span><span >i = 1:length(exchanges)</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    modelalter = changeRxnBounds(modelalter,exchanges{i},0,</span><span style="color: rgb(170, 4, 249);">'l'</span><span >);</span></span></div></div><div class="inlineWrapper"><div  class = 'S8'><span style="white-space: normal"><span style="color: rgb(14, 0, 255);">end</span></span></div></div></div><div  class = 'S1'><span style=' font-weight: bold;'>2.2. Generate multiple models by allowing different carbon sources to be fed into each model</span></div><div  class = 'S1'><span>Select one carbon source to be fed into the model at a time using 20 units.</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: normal"><span >allModels = {};</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span style="color: rgb(14, 0, 255);">for </span><span >i = 1:length(exchanges)</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    model = modelalter;</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(2, 128, 9);">% Change bound of the corresponding exchange reaction using 20 units</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    model = changeRxnBounds(model, exchanges{i}, -20, </span><span style="color: rgb(170, 4, 249);">'l'</span><span >);</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(2, 128, 9);">% New model name</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    str = exchanges{i};</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    match = {</span><span style="color: rgb(170, 4, 249);">'-'</span><span >,</span><span style="color: rgb(170, 4, 249);">'(e)'</span><span >};</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(14, 0, 255);">for </span><span >j=1:size(match,2)</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >        str = strrep(str, match{j},{</span><span style="color: rgb(170, 4, 249);">''</span><span >});</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(14, 0, 255);">end</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    newModelName = horzcat(str{1},</span><span style="color: rgb(170, 4, 249);">'_model'</span><span >);</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(2, 128, 9);">% Combine models in a structure</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    allModels.(newModelName) = model;</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span style="color: rgb(14, 0, 255);">end</span></span></div></div><div class="inlineWrapper"><div  class = 'S8'></div></div></div><div  class = 'S1'><span style=' font-weight: bold;'>2.3 Delete every reaction in each model to study their essentiatity across:</span></div><div  class = 'S1'><span>Perform single reaction deletion (</span><span style=' font-family: monospace;'>singleRxnDeletion.m</span><span>) across all models by using the function </span><span style=' font-family: monospace;'>essentialRxn4MultipleModels.m</span><span> </span></div><div  class = 'S1'><span>TIMING: aprox. 10 seconds per model (~3min)</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: normal"><span style="color: rgb(2, 128, 9);">%allModels = '/hdd/work/sbgCloud/programReconstruction/projects/brainMetabolism/results/modelGeneration/models/cutoff_50'</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'></div></div><div class="inlineWrapper outputs"><div  class = 'S11'><span style="white-space: normal"><span >[ essentialRxn4Models, dataStruct] = essentialRxn4MultipleModels(allModels, objFun);</span></span></div><div  class = 'S5'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement" uid="83EE9D89" data-testid="output_3" data-width="428" data-height="59" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"> 
Analysing model: 
EX_12dgr_m_model
Single reaction deletion analysis in progress ...</div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="FDB6560E" data-testid="output_4" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="2501F109" data-testid="output_5" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="E2F63324" data-testid="output_6" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="0194B79E" data-testid="output_7" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="3B9DA03F" data-testid="output_8" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="66973347" data-testid="output_9" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="CF24F9B3" data-testid="output_10" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="47310F82" data-testid="output_11" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="B9CF292E" data-testid="output_12" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="31495A92" data-testid="output_13" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="A54548D6" data-testid="output_14" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="FD5F0150" data-testid="output_15" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="90B56E87" data-testid="output_16" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="7BB8A617" data-testid="output_17" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="E8EBB348" data-testid="output_18" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="8F84C927" data-testid="output_19" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="922DDC1F" data-testid="output_20" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="D68BEF04" data-testid="output_21" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div></div></div></div><div  class = 'S1'><span style=' font-weight: bold;'>2.4. Study reaction essentiality across all models by conditional search:</span></div><div  class = 'S1'><span style=' font-weight: bold;'>Define an essentiality threshold:</span><span> reactions for which its deletion resulted in an 'ATPS4mi' flux below the threshold value will be considered essential for the model.</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S9'><span style="white-space: normal"><span >essentialityRange = [-100,100]; </span><span style="color: rgb(2, 128, 9);">%negative values only represent absent reactions</span></span></div></div></div><div  class = 'S6'><span>In the following heatmaps, reactions with the lowest positive flux values (minimum in </span><span style=' font-family: monospace;'>essentialityRange</span><span>) are coloured in red and reactions that carry flux (close the the higher flux value in </span><span style=' font-family: monospace;'>essentialityRange</span><span>) are coloured in black. Intermediate flux values will be coloured in orange (less flux) and yellow (more flux).</span></div><div  class = 'S1'><span style=' font-weight: bold;'>2.4.1. Identify reactions that are essential in at least one model:</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: normal"><span >numModelsPresent = 1;</span></span></div></div><div class="inlineWrapper outputs"><div  class = 'S11'><span style="white-space: normal"><span >rxnsOfInterest_1Model = plotEssentialRxns( essentialRxn4Models, essentialityRange, numModelsPresent);</span></span></div><div  class = 'S5'><div class="inlineElement eoOutputWrapper embeddedOutputsFigure" uid="98F8C1F4" data-testid="output_22" style="width: 458px;"><div class="figureElement"><img class="figureImage figureContainingNode" src=""></div></div></div></div></div><div  class = 'S1'><span style=' font-weight: bold;'>2.4.2. Identify reactions that are essential in at least 11 models:</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: normal"><span >numModelsPresent = 11;</span></span></div></div><div class="inlineWrapper outputs"><div  class = 'S11'><span style="white-space: normal"><span >rxnsOfInterest_11Models = plotEssentialRxns( essentialRxn4Models, essentialityRange, numModelsPresent);</span></span></div><div  class = 'S5'><div class="inlineElement eoOutputWrapper embeddedOutputsFigure" uid="CEE3A075" data-testid="output_23" style="width: 458px;"><div class="figureElement"><img class="figureImage figureContainingNode" src=""></div></div></div></div></div><div  class = 'S1'><span style=' font-weight: bold;'>2.4.3.  Identify reactions that are essential in at least 17 models:</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: normal"><span >numModelsPresent = 17;</span></span></div></div><div class="inlineWrapper outputs"><div  class = 'S11'><span style="white-space: normal"><span >rxnsOfInterest_17Models = plotEssentialRxns( essentialRxn4Models, essentialityRange, numModelsPresent);</span></span></div><div  class = 'S5'><div class="inlineElement eoOutputWrapper embeddedOutputsFigure" uid="44FE708A" data-testid="output_24" style="width: 458px;"><div class="figureElement"><img class="figureImage figureContainingNode" src=""></div></div></div></div></div><div  class = 'S6'><span style=' font-weight: bold;'></span></div><div  class = 'S1'><span style=' font-weight: bold;'>2.4.4.  Identify reactions that are essential and present in all models:</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: normal"><span >numModelsPresent = size(essentialRxn4Models(:,2:end),2);</span></span></div></div><div class="inlineWrapper outputs"><div  class = 'S11'><span style="white-space: normal"><span >rxnsOfInterest_allModels = plotEssentialRxns( essentialRxn4Models, essentialityRange, numModelsPresent);</span></span></div><div  class = 'S5'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement scrollableOutput" uid="94AB7D73" data-testid="output_25" data-width="428" data-height="18" data-hashorizontaloverflow="true" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"> Attention: All non-essential reactions have flux above the threshold </div></div></div></div></div><div  class = 'S1'><span style=' font-weight: bold;'>2.4.5. Identify reactions that are essential and always present in all models:</span></div><div  class = 'S1'><span>Allow only reactions that are present across all models by adjusting the lower value of the </span><span style=' font-family: monospace;'>essentialityRange</span><span> to a non-negative value.</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S9'><span style="white-space: normal"><span >essentialityRange = [0,0]; </span><span style="color: rgb(2, 128, 9);">% only reactions</span></span></div></div></div><div  class = 'S6'><span>Now identify the present reactions that are essential in at least one model</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: normal"><span >numModelsPresent = 1;</span></span></div></div><div class="inlineWrapper outputs"><div  class = 'S11'><span style="white-space: normal"><span >presentRxnsOfInterest_1Model = plotEssentialRxns( essentialRxn4Models, essentialityRange, numModelsPresent);</span></span></div><div  class = 'S5'><div class="inlineElement eoOutputWrapper embeddedOutputsFigure" uid="83D064F2" data-testid="output_26" style="width: 458px;"><div class="figureElement"><img class="figureImage figureContainingNode" src=""></div></div></div></div></div><div  class = 'S1'><span style=' font-weight: bold;'>2.4.6. Identify reactions that are never essential in all models:</span></div><div  class = 'S1'><span>Allow only reactions that are present across all models by adjusting the lower value of the </span><span style=' font-family: monospace;'>essentialityRange</span><span> to a positive value (e.g. 50 units).</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: normal"><span >essentialityRange = [50,100]; </span><span style="color: rgb(2, 128, 9);">% always positive fluxes</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >numModelsPresent = 1; </span></span></div></div><div class="inlineWrapper outputs"><div  class = 'S11'><span style="white-space: normal"><span >rxnsOfInterest = plotEssentialRxns( essentialRxn4Models, essentialityRange, numModelsPresent);</span></span></div><div  class = 'S5'><div class="inlineElement eoOutputWrapper embeddedOutputsFigure" uid="1365AF57" data-testid="output_27" style="width: 458px;"><div class="figureElement"><img class="figureImage figureContainingNode" src=""></div></div></div></div></div><h2  class = 'S3'><span>3. Allow different max fluxes in NADH reaction and test reaction essentiality across all models</span></h2><div  class = 'S1'><span>Use again the </span><span style=' font-family: monospace;'>modelCardioMito</span><span> model</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S9'><span style="white-space: normal"><span >titratioModel = modelCardioMito;</span></span></div></div></div><div  class = 'S6'><span style=' font-weight: bold;'>3.1. Select the reaction </span><span style=' font-weight: bold; font-family: monospace;'>NADH2-u10m</span><span style=' font-weight: bold;'> to be titrated and the titration ranges</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: normal"><span >reaction4titration = </span><span style="color: rgb(170, 4, 249);">'NADH2-u10m'</span><span >;</span></span></div></div><div class="inlineWrapper"><div  class = 'S8'><span style="white-space: normal"><span >titrationFluxes = (-40:20:300);</span></span></div></div></div><div  class = 'S6'><span>Generate multiple models with bound constraint (</span><span style=' font-family: monospace;'>titrationFluxes</span><span>) in the reaction </span><span style=' font-weight: bold; font-family: monospace;'>NADH2-u10m</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: normal"><span >allTitrationModels = {};</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span style="color: rgb(14, 0, 255);">for </span><span >i = 1:length(exchanges)</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    model = titratioModel;</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(2, 128, 9);">% Change bound of the corresponding exchange reaction using 20 units</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    model = changeRxnBounds(model, reaction4titration, titrationFluxes(i), </span><span style="color: rgb(170, 4, 249);">'b'</span><span >);</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(2, 128, 9);">% New model name</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    str = reaction4titration;</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    match = {</span><span style="color: rgb(170, 4, 249);">'-'</span><span >,</span><span style="color: rgb(170, 4, 249);">'(e)'</span><span >};</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(14, 0, 255);">for </span><span >j=1:size(match,2)</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >        str = strrep(str, match{j},{</span><span style="color: rgb(170, 4, 249);">''</span><span >});</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(14, 0, 255);">end</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    fluxValue = num2str(titrationFluxes(i));</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    fluxValue = strrep(fluxValue, </span><span style="color: rgb(170, 4, 249);">'-'</span><span >,</span><span style="color: rgb(170, 4, 249);">'minus'</span><span >);</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    newModelName = horzcat(str{1,1},</span><span style="color: rgb(170, 4, 249);">'Flux'</span><span >,fluxValue,</span><span style="color: rgb(170, 4, 249);">'Model'</span><span >);</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    </span><span style="color: rgb(2, 128, 9);">% Combine models in a structure</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >    allTitrationModels.(newModelName) = model;</span></span></div></div><div class="inlineWrapper"><div  class = 'S8'><span style="white-space: normal"><span style="color: rgb(14, 0, 255);">end</span></span></div></div></div><div  class = 'S1'><span style=' font-weight: bold;'>3.2. Delete every reaction in each model to study their essentiatity across:</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div  class = 'S4'><span style="white-space: normal"><span >[ essentialRxn4NADHModels, dataStruct] = essentialRxn4MultipleModels(allTitrationModels, objFun);</span></span></div><div  class = 'S5'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement" uid="EF0B5537" data-testid="output_28" data-width="428" data-height="59" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"> 
Analysing model: 
NADH2u10mFluxminus40Model
Single reaction deletion analysis in progress ...</div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="F49D7B27" data-testid="output_29" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="C401F358" data-testid="output_30" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="B3F876A9" data-testid="output_31" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="7C211CEE" data-testid="output_32" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="1B1678B8" data-testid="output_33" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="0296452E" data-testid="output_34" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="0682026F" data-testid="output_35" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="0F31EA64" data-testid="output_36" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="86A55444" data-testid="output_37" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="8E4234C8" data-testid="output_38" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="44C4B4A5" data-testid="output_39" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="4205276D" data-testid="output_40" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="FCA8339C" data-testid="output_41" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="78B4636D" data-testid="output_42" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="3D79703F" data-testid="output_43" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="3F213E0C" data-testid="output_44" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="72780B48" data-testid="output_45" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="C9382469" data-testid="output_46" data-width="428" data-height="44" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: The new variables being added to the table have fewer rows than the table. They have been extended with rows containing default values.</div><div class="diagnosticMessage-stackPart" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div></div></div></div><div  class = 'S1'><span style=' font-weight: bold;'>3.3. Study reaction essentiality across all models by conditional search:</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: normal"><span >essentialityRange = [-100,100]; </span><span style="color: rgb(2, 128, 9);">%negative values only represent absent reactions</span></span></div></div><div class="inlineWrapper"><div  class = 'S10'><span style="white-space: normal"><span >numModelsPresent = 1; </span><span style="color: rgb(2, 128, 9);">% essential reactions in at least 1 model</span></span></div></div><div class="inlineWrapper outputs"><div  class = 'S11'><span style="white-space: normal"><span >rxnsOfInterest_NADH1Model = plotEssentialRxns( essentialRxn4NADHModels, essentialityRange, numModelsPresent);</span></span></div><div  class = 'S5'><div class="inlineElement eoOutputWrapper embeddedOutputsFigure" uid="9D3BBC94" data-testid="output_47" style="width: 458px;"><div class="figureElement"><img class="figureImage figureContainingNode" src=""></div></div></div></div></div><h2  class = 'S3'></h2>
<br>
<!-- 
##### SOURCE BEGIN #####
%% *Reaction essentiality across multiple models*
% 
% 
% *Note: This tutorial is a draft and needs completion. Contributions welcome!*
% 
% 
% 
% *Authors: Miguel A.P. Oliveira, Diana C. El Assal-Jordan, Sylvain Arreckx 
% and Ronan M.T. Fleming, Luxembourg Centre for Systems Biomedicine*
% 
% *Reviewers:* 
%% Introduction
% During this tutorial, you will identify and compare which reactions are essential 
% for ATP production within a set of metabolic models. This tutorial is particularly 
% useful when studying metabolic functional abilities across multiple metabolic 
% models.
% 
% This driver allows us to perform single reactions to identify essential ones 
% that are required for ATP generation. This means that these essential reactions 
% would carry a zero flux when optimising the ATP consumption reaction (ATPM).
% 
% Version 5/12/2017
%% EQUIPMENT SETUP
%% *Initialize the COBRA Toolbox* and set the solver
% Please ensure that The CobraToolbox has been properly installed, and initialized 
% using the |initCobraToolbox| function.

initCobraToolbox(false) % false, as we don't want to update
%% 
% The present tutorial can run with <https://opencobra.github.io/cobratoolbox/deprecated/docs/cobra/solvers/changeCobraSolver.html 
% glpk package>, which does not require additional installation and configuration. 
% Although, for the analysis of large models it is recommended to use the <https://github.com/opencobra/cobratoolbox/blob/master/docs/source/installation/solvers.md 
% GUROBI> package.

changeCobraSolver('gurobi6','all')
%% Define model directory
% In this tutorial, we use the cardiac model |modelCardioMito| [1] and study 
% reaction essentiality across multiple versions this model based on the carbon 
% sources used. This models was extracted from the latest version of the database 
% of the human cellular metabolism, Recon 3D. For extra information about metabolites 
% structures and reactions, and to download the latest COBRA model releases, visit 
% the Virtual Metabolic Human database (VMH, <https://vmh.life https://vmh.life>). 
% 
% Before proceeding with the simulations, locate the directory with the cardiac 
% models: 

modelName = 'cardiac_mit_glcuptake_atpmax.mat';
modelsDir = getDistributedModelFolder(modelName);
%% PROCEDURE 
%% *1. Load the* |modelCardioMito| *model at set objective function:*

load([modelsDir filesep modelName])
%% 
% Since we are studying reaction essentiality define the reaction |ATPS4m| as 
% the objective function:

objFun = 'ATPS4m';
%% *2. Generate multiple cardiac models that use different carbon sources*
% *2.1. Close exchange reactions:*

modelalter = modelCardioMito;
exchanges = {'EX_12dgr_m(e)'
    'EX_arachd(e)'
    'EX_co2(e)'
    'EX_coa(e)'
    'EX_crvnc(e)'
    'EX_cys-L(e)'
    'EX_glc(e)'
    'EX_glu-L(e)'
    'EX_gly(e)'
    'EX_glyc(e)'
    'EX_glyc3p(e)'
    'EX_hdca(e)'
    'EX_lac-L(e)'
    'EX_ocdca(e)'
    'EX_ocdcea(e)'
    'EX_ocdcya(e)'
    'EX_ps_m(e)'
    'EX_urea(e)'};
for i = 1:length(exchanges)
    modelalter = changeRxnBounds(modelalter,exchanges{i},0,'l');
end
%% 
% *2.2. Generate multiple models by allowing different carbon sources to be 
% fed into each model*
% 
% Select one carbon source to be fed into the model at a time using 20 units.

allModels = {};
for i = 1:length(exchanges)
    model = modelalter;
    % Change bound of the corresponding exchange reaction using 20 units
    model = changeRxnBounds(model, exchanges{i}, -20, 'l');
    
    % New model name
    str = exchanges{i};
    match = {'-','(e)'};
    for j=1:size(match,2)
        str = strrep(str, match{j},{''});
    end
    newModelName = horzcat(str{1},'_model');
    
    % Combine models in a structure
    allModels.(newModelName) = model;
end

%% 
% *2.3 Delete every reaction in each model to study their essentiatity across:*
% 
% Perform single reaction deletion (|singleRxnDeletion.m|) across all models 
% by using the function |essentialRxn4MultipleModels.m| 
% 
% TIMING: aprox. 10 seconds per model (~3min)

%allModels = '/hdd/work/sbgCloud/programReconstruction/projects/brainMetabolism/results/modelGeneration/models/cutoff_50'

[ essentialRxn4Models, dataStruct] = essentialRxn4MultipleModels(allModels, objFun);
%% 
% *2.4. Study reaction essentiality across all models by conditional search:*
% 
% *Define an essentiality threshold:* reactions for which its deletion resulted 
% in an 'ATPS4mi' flux below the threshold value will be considered essential 
% for the model.

essentialityRange = [-100,100]; %negative values only represent absent reactions
%% 
% In the following heatmaps, reactions with the lowest positive flux values 
% (minimum in |essentialityRange|) are coloured in red and reactions that carry 
% flux (close the the higher flux value in |essentialityRange|) are coloured in 
% black. Intermediate flux values will be coloured in orange (less flux) and yellow 
% (more flux).
% 
% *2.4.1. Identify reactions that are essential in at least one model:*

numModelsPresent = 1;
rxnsOfInterest_1Model = plotEssentialRxns( essentialRxn4Models, essentialityRange, numModelsPresent);
%% 
% *2.4.2. Identify reactions that are essential in at least 11 models:*

numModelsPresent = 11;
rxnsOfInterest_11Models = plotEssentialRxns( essentialRxn4Models, essentialityRange, numModelsPresent);
%% 
% *2.4.3.  Identify reactions that are essential in at least 17 models:*

numModelsPresent = 17;
rxnsOfInterest_17Models = plotEssentialRxns( essentialRxn4Models, essentialityRange, numModelsPresent);
%% 
% 
%% 
% *2.4.4.  Identify reactions that are essential and present in all models:*

numModelsPresent = size(essentialRxn4Models(:,2:end),2);
rxnsOfInterest_allModels = plotEssentialRxns( essentialRxn4Models, essentialityRange, numModelsPresent);
%% 
% *2.4.5. Identify reactions that are essential and always present in all models:*
% 
% Allow only reactions that are present across all models by adjusting the lower 
% value of the |essentialityRange| to a non-negative value.

essentialityRange = [0,0]; % only reactions
%% 
% Now identify the present reactions that are essential in at least one model

numModelsPresent = 1;
presentRxnsOfInterest_1Model = plotEssentialRxns( essentialRxn4Models, essentialityRange, numModelsPresent);
%% 
% *2.4.6. Identify reactions that are never essential in all models:*
% 
% Allow only reactions that are present across all models by adjusting the lower 
% value of the |essentialityRange| to a positive value (e.g. 50 units).

essentialityRange = [50,100]; % always positive fluxes
numModelsPresent = 1; 
rxnsOfInterest = plotEssentialRxns( essentialRxn4Models, essentialityRange, numModelsPresent);
%% 3. Allow different max fluxes in NADH reaction and test reaction essentiality across all models
% Use again the |modelCardioMito| model

titratioModel = modelCardioMito;
%% 
% *3.1. Select the reaction |NADH2-u10m| to be titrated and the titration ranges*

reaction4titration = 'NADH2-u10m';
titrationFluxes = (-40:20:300);
%% 
% Generate multiple models with bound constraint (|titrationFluxes|) in the 
% reaction |*NADH2-u10m*|

allTitrationModels = {};
for i = 1:length(exchanges)
    model = titratioModel;
    % Change bound of the corresponding exchange reaction using 20 units
    model = changeRxnBounds(model, reaction4titration, titrationFluxes(i), 'b');
    
    % New model name
    str = reaction4titration;
    match = {'-','(e)'};
    for j=1:size(match,2)
        str = strrep(str, match{j},{''});
    end
    fluxValue = num2str(titrationFluxes(i));
    fluxValue = strrep(fluxValue, '-','minus');
    newModelName = horzcat(str{1,1},'Flux',fluxValue,'Model');

    % Combine models in a structure
    allTitrationModels.(newModelName) = model;
end
%% 
% *3.2. Delete every reaction in each model to study their essentiatity across:*

[ essentialRxn4NADHModels, dataStruct] = essentialRxn4MultipleModels(allTitrationModels, objFun);
%% 
% *3.3. Study reaction essentiality across all models by conditional search:*

essentialityRange = [-100,100]; %negative values only represent absent reactions
numModelsPresent = 1; % essential reactions in at least 1 model
rxnsOfInterest_NADH1Model = plotEssentialRxns( essentialRxn4NADHModels, essentialityRange, numModelsPresent);
%%
##### SOURCE END #####
-->
</div></body></html>